<template>
  <div class="record">
    <Header title="档案卡" />
    <div class="content">
      <div
        class="list1"
        :id="deindex===index?'oo':null"
        v-for="(item,index) in arr"
        :key="index"
        @click="pucker(index)"
      >
        <div class="title">
          <p>
            <span class="typeClass">{{item.title}}</span>
            <span class="detal" @click="$router.push({path:item.path})" v-if="deindex===index">详情</span>
          </p>
          <div class="progress" v-if="deindex===index">
            <p>
              完成度 ：
              <span>{{item.grame}}</span>分
            </p>
            <p>
              <span id="progress" :style="`width:${item.grame*.83*10}%`"></span>
            </p>
          </div>
        </div>
        <div class="list_content" v-if="deindex===index">
          <li>
            <span>编号</span>
            <span>PDB19881122HYLX</span>
          </li>
          <li>
            <span>昵称</span>
            <span>球王</span>
          </li>
          <li>
            <span>姓名</span>
            <span>赵伟国</span>
          </li>
          <li>
            <span>性别</span>
            <span>男</span>
          </li>
          <li>
            <span>生日</span>
            <span>1988-01-23</span>
          </li>
        </div>
      </div>
    </div>
  </div>
</template>
<script lang="ts">
import Vue from "vue";
import Header from "@/components/header.vue";
export default Vue.extend({
  methods: {
    pucker(index: number) {
      if (this.deindex === index) {
        this.deindex = -1;
      } else {
        this.deindex = index;
      }
    },
  },
  data() {
    return {
      arr: [
        {
          title: "个人档案卡",
          grame: 8,
          path: "myself",
        },
        {
          title: "健康档案卡",
          grame: 7,
          path: "",
        },
        {
          title: "教育档案卡",
          grame: 10,
          path: "",
        },
        {
          title: "工作档案卡",
          grame: 4,
          path: "",
        },
        {
          title: "社交档案卡",
          grame: 5,
          path: "",
        },
        {
          title: "运营商档案卡",
          grame: 2,
          path: "",
        },
      ],
      deindex: -1,
    };
  },
  components: {
    Header,
  },
});
</script>
<style scoped>
/* title */
.record {
  background: #eee;
  height: 100vh;
}
.title > p {
  height: 80%;
}
.typeClass {
  font-size: 18px;
}
.detal {
  background: white;
  color: black;
  float: right;
  padding: 5px 12px;
  border-radius: 5px;
  font-size: 14px;
}
.progress p:nth-child(2) {
  width: 100%;
  height: 5px;
  margin: 15px 0;
  background-color: rgba(174, 174, 174, 1);
}
#progress {
  display: inline-block;
  height: 5px;
  position: absolute;
  background: white;
}
.title {
  height: 220px;
  border-radius: 15px;
  color: white;
  width: 83%;
  padding: 15px;
  margin: 15px auto;
}
/* list */
.list_content {
  background: white;
}
.list_content li {
  display: flex;
  width: 90%;
  margin: 0 auto;
  padding: 8px 0;
  border-bottom: 1px solid #eee;
  justify-content: space-between;
}
/* content list1 */

#oo {
  height: 525px;
}
.list1 {
  left: 8px;
  right: 8px;
  height: 50px;
  transition: all 1s;
}
.content > .list1:nth-child(1) .title {
  background: rgba(174, 174, 174, 1);
}
.content > .list1:nth-child(2) .title {
  background: rgba(148, 148, 148, 1);
}
.content > .list1:nth-child(3) .title {
  background: rgba(121, 121, 121, 1);
}
.content > .list1:nth-child(4) .title {
  background: rgba(94, 94, 94, 1);
}
.content > .list1:nth-child(5) .title {
  background: rgba(67, 67, 67, 1);
}
.content > .list1:nth-child(6) .title {
  background: rgba(40, 40, 40, 1);
}
</style>
